package com.digiwin.demo.util;

import com.digiwin.demo.constant.ConfigConstant;
import org.apache.flink.api.java.io.jdbc.JDBCOutputFormat;

import java.io.Serializable;

/**
 * @Author yanggld
 * @Date 2019/12/26-16:48
 * @Description
 */
public class MysqlUtil {

	public static final String driverClass = ConfigConstant.MYSQL_DRIVERCLASS;
	public static final String dbUrl = ConfigConstant.MYSQL_URL;
	public static final String userNmae = ConfigConstant.MYSQL_USERNAME;
	public static final String passWord = ConfigConstant.MYSQL_PASSWORD;

	public static JDBCOutputFormat buildJDBCOutputFormat(String sql){
		return JDBCOutputFormat.buildJDBCOutputFormat()
				.setDrivername(driverClass)
				.setDBUrl(dbUrl)
				.setUsername(userNmae)
				.setPassword(passWord)
				.setQuery(sql)
				.finish();
	}

}
